/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/6
 * Time: 17:49
 * Description: No Description
 */
class Animal {
    public String name;
    public int age;

    public void eat() {
        System.out.println("这是一个父类重写方法");
    }
}

class Cat extends Animal{
    public String hair;

    public void eat() {
        System.out.println("这是一个子类重写方法");
    }
}

public class TestDemo {
    public static void main(String[] args) {
        Animal animal = new Cat();
        animal.eat();
    }
}